<?php
include ('top.ajax.php');

$nav = Navigation::getInstance();
$slug=$nav->getRewrite(utf8_decode($_POST['tag']));
$nom=utf8_decode($_POST['tag']);

	if(!(ProductTag::existProductTag($slug))){
		$tag=new ProductTag();
		$tag['nom']=$nom;
		$tag['slug']=$slug;
		$tag->save();
		
	}
	else{
		$tag=ProductTag::get($slug);
		
}
$_SESSION['newProduct']->addTag($tag);
echo $tag['id'];


?>